﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PBOffice.BLL;
public partial class MsgMng_SentBox : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
		
    }

	protected void cbAll_CheckedChanged(object sender, EventArgs e)
	{
		gvSentBox.DataBind();
		foreach (GridViewRow row in gvSentBox.Rows)
		{
			var cb = row.FindControl("cbDel") as CheckBox;
			cb.Checked = cbAll.Checked;
		}
	}
	protected void bDelete_Click(object sender, EventArgs e)
	{
		using (var mmb = new MsgMngBLL())
		{
			foreach (GridViewRow row in gvSentBox.Rows)
			{
				var cb = row.FindControl("cbDel") as CheckBox;
				if (cb.Checked)
				{
					var hf = row.FindControl("hfID") as HiddenField;
					mmb.DeleteMess(int.Parse(hf.Value));
				}
			}
		}
	}
}